{extend name='admin@main'}
{block name="button"}
{if auth("remove")}
<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" data-confirm="确定要删除这些记录吗？" class='layui-btn layui-btn-sm layui-btn-primary'>删除记录</button>
{/if}
{/block}
{block name="content"}
<div class="think-box-shadow">
    {include file='withdraw_record/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
            </th>
            <th class='text-left'>用户</th>
            <th class="text-left">提现金额</th>
            <th class="text-left">提现地址</th>
            <th class="text-left">查看已投项目</th>
            <th class="text-left">提交时间</th>
            <th class="text-left">处理进度</th>
            <th class="text-left">操作</th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='list-table-check-td think-checkbox'>
                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
            </td>
            <td class='text-left'>
                {$vo.username|default='--'}
            </td>
            <td class='text-left'>
                {$vo.money|number_format=2}
                {if $vo.charge>0}
                    <span class="color-red">手续费：{$vo.charge|number_format=2}</span><br>
                {/if}
            </td>
            <td class='text-left'>
                {$vo.usdt_address|default='--'}
            </td>
            <td class='text-left'>
                {if auth("admin/invest_list/detail")}
                <a data-title="查看详情" class="layui-btn layui-btn-sm" data-open='{:url("admin/invest/index")}?u_username={$vo.username}'>查看详情</a>
                {/if}
            </td>
            <td class='text-left'>
                {$vo.time|default='--'}
            </td>
            <td class='text-left'>
                {if $vo.status == 0}
                <span class="color-red">审核中</span>
                {/if}
                {if $vo.status == 1}
                <span class="color-green">已完成</span>
                {/if}
                {if $vo.status == 2}
                <span class="color-desc">提现失败</span>
                {/if}
                {if $vo.status == 3}
                <span class="color-red">优盾审核中</span>
                {/if}
                {if $vo.status == 4}
                <span class="color-red">优盾代付中</span>
                {/if}
            </td>
            <td class='text-left'>
                {if $vo.status eq 0}
                    {if auth("agree")}
                    <a class="layui-btn layui-btn layui-btn-xs" data-confirm="确定要同意提现吗？" data-action="{:url('agree')}" data-value="id#{$vo.id}" data-csrf="{:systoken('agree')}">同意</a>
                    {else}
                        <a data-tips-text="您没有同意的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">同意</a>
                    {/if}
                    {if auth("refuse")}
                    <a class="layui-btn layui-btn layui-btn-xs" onclick="refuse(this)" data-id="{$vo.id}" data-csrf="{:systoken('refuse')}">拒绝</a>
                    {else}
                        <a data-tips-text="您没有拒绝的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">拒绝</a>
                    {/if}
                {else}
                    {if auth("remove")}
                    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删除</a>
                    {else}
                    <a data-tips-text="您没有删除的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">删除</a>
                    {/if}
                {/if}
            </td>

        </tr>
        {/foreach}
        </tbody>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
<div id="refuse_view" class="layui-hide">
    <form onsubmit="return do_refuse(this);" data-auto="true" action="{:url('refuse')}" method="post" class='layui-form layui-card' autocomplete="off">
        <div class="layui-card-body padding-left-40">
            <div class="layui-form-item layui-row layui-col-space15">
                <input name="reason" class="layui-input" placeholder="请输入拒绝原因">
            </div>
        </div>
        <input type="hidden" name="id">
        <input type="hidden" name="_csrf_">
        <div class="hr-line-dashed margin-top-40"></div>
        <div class="layui-form-item text-center">
            <button class="layui-btn" type='submit'>确定</button>
            <button class="layui-btn layui-btn-danger" type='button' onclick="close_refuse()">取消</button>
        </div>
    </form>
</div>
{/block}
{block name='script'}
<script>
    var refuseModal;
    function refuse(that){
        var that = $(that);
        $('#refuse_view [name="_csrf_"]').val(that.data('csrf'));
        $('#refuse_view [name="id"]').val(that.data('id'));
        refuseModal = layer.open({
            type: 1,
            title:'拒绝',
            area: ['420px', '240px'],
            content: $('#refuse_view').html()
        });
    }
    function do_refuse(form){
        $.form.load("{:url('refuse')}", $(form).formToJson(), 'post', function(){
            layer.close(refuseModal);
        });
        return false;
    }
    function close_refuse(){
        layer.close(refuseModal);
    }
    
</script>
{/block}